package com.shujia.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class Code6DeleteFile {
    public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {
        // 可以在resource目录中添加log4j.properties来控制打印台信息
        Configuration conf = new Configuration();
        FileSystem fileSystem = FileSystem.get(new URI("hdfs://master:9000"), conf, "root");
        // delete方法中 recursive参数为 如果Path为目录那么对应参数值要为TRUE
        fileSystem.delete(new Path("/data/ddd1.txt"),false);
        fileSystem.close();
    }
}
